package org.example.chapter3_3.dao;


import org.apache.ibatis.annotations.*;
import org.example.chapter3_3.entity.Student;
import org.example.chapter3_3.entity.User;

@Mapper
public interface UserDao {
    @Select("select * from user where username = #{username}")
    User getUserByname(String username);

    @Results(id = "userMap",value = {
            @Result(property = "name",column = "username"),
            @Result(property = "password",column = "password")
    })
    @Select("select * from user where username = #{username} and password = #{password}")
    User getUserByName(@Param("username") String name,String password);

    @Insert("insert into user(username,password) values (#{username},#{password})")
    int creatUser(User user);
}